A compiler is a computer program, or set of programs, that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). Typically a compiler performs a variety of functions including lexical analysis, preprocessing, parsing, semantic analysis (e.g., syntax-directed translation), code generation, and code optimization.
The most common use of a compiler is to create an executable program from source code. In such instances, a compiler is often used in conjunction with a computer program called a linker that takes one or more object files generated by the compiler and combines them into a single executable program.